package com.study;

import com.study.util.FileUtil;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * TODO
 *
 * @author wanghuilong
 * @version 1.0
 * @date 2021/12/30 5:41 下午
 */
public class Test12 {

    public static void main(String[] args) {

        String sql = "{\"businessSkuCode\":\"$0\",\"titlePinyin\":\"$1\",\"titleAcronym\":\"$2\"}";

        List<String> strings = FileUtil.readTxtFileIntoStringArrList("/Users/wanghuilong/IdeaProjects/lazy/src/main/resources/file/8.txt", null);
        StringBuilder sb = new StringBuilder();
        for (String str : strings) {
            if(StringUtils.isBlank(str)) {
                continue;
            }
            String[] split = str.trim().split("\t");
            String actSql1 = sql;
            for (int i = 0; i < split.length; i++) {
                String matchStr = "$" + i ;
                actSql1 = actSql1.replace(matchStr, split[i]);
            }
            sb.append(actSql1).append(",");
        }
        System.out.println(sb);
    }
}
